<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="lib/daterangepicker/daterangepicker.css" /> 
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>券列表</title>
</head>
<body class="pos-r">

<!-- <div class="ui-loading-block" id="loading">
    <div class="ui-loading-cnt">
        <i class="ui-loading-bright"></i>
        <p>正在加载中...</p>
    </div>
</div> -->

<div >
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> <a _href="welcome.html" class="fun-toindex" href="javascript:;">首页</a> 
		<span class="c-gray en">&gt;</span><a href="product-list.html"> 券管理</a> 
		<span class="c-gray en">&gt;</span> 券列表 
		<a class="btn btn-success radius r mr-20 reload" style="line-height:1.6em;margin-top:3px" href="javascript:;" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
		<span class="r" style="margin-top: -2px; box-sizing: border-box;">
			<!-- <select name="cid1" id="cid1" class="select" style="width: auto; height: 31px; vertical-align: middle;">
				<option value="" selected="">全部分类</option>
			</select>

			<select name="cid2" id="cid2" class="select" style="width: auto; height: 31px; vertical-align: middle;">
				<option value="" selected="">全部分类</option>
			</select> -->

			<select name="from" id="from" class="select" style="width: auto; height: 31px; vertical-align: middle;">
				<option value="" selected="">券来源</option>
				<option value="sys">置换返券</option>
				<option value="receive">会员赠送</option>
				<option value="buy">现金购买</option>
				<option value="qiandao">签到</option>
			</select>
			<div style="display:inline-block; width:380px; position:relative;">
				日期范围：
				<input name="time" type="text" id="date-range1" class="input-text datainp" style="width:300px">
				<i class="Hui-iconfont i-close" id="inputclear">&#xe706;</i>
			</div>
			
			<span style="position:relative">
				<input type="text" name="k" id="search-input" placeholder="发放者用户名" style="width:250px" class="input-text">
				<i class="Hui-iconfont i-close" id="inputclear">&#xe706;</i>
			</span>

			<button name="" id="search" class="btn btn-success"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
			<button id='export' class="btn btn-success">导出EXCEL</button>
		</span>
	</nav>
		
		
	<div class="pd-10">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c sort0">
					<th width="40" class="valueid"><input name="" type="checkbox" value=""></th>
					<th width="40" class="fun-sort2" data-name="tic_id" data-flag="0">ID</th>
					<!-- <th>商品名称</th> -->
					<th width="80">来源</th>
					<th width="60">券接收者</th>
					<th width="60">总数</th>
					<th width="60">剩余数</th>
					<th width="150" class="fun-sort2" data-name="tic_addtime" data-flag="0">发布时间</th>
					<th width="60" class="fun-sort2" data-name="yu_days" data-flag="0">剩余天数</th>

				</tr>
			</thead>
			<tbody id="content_sp">
			  
			</tbody>
		</table>	
	</div>

	<div class="cl pd-5 bg-1 bk-gray mt-20 mb-20"> 
		<!-- <a href="javascript:;" class="btn btn-warning l mr-10 mt-5 radius fun-all" data-type="stop"><i class="Hui-iconfont">&#xe6de;</i> 批量关闭</a> 
		<a href="javascript:;" class="btn btn-success l mr-10 mt-5 radius fun-all" data-type="start"><i class="Hui-iconfont">&#xe603;</i> 批量开启</a> 
		<a href="javascript:;" class="btn btn-danger l mr-10 mt-5 radius fun-all" data-type="del"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> 

		<a style="text-decoration:none" onClick="_open('添加商品','product-add.html','90%','80%',true)" class="btn btn-warning l mr-10 mt-5 radius" href="javascript:;" title="添加商品">添加商品</a> 
 -->

		<span class="r pt-5"  style="line-height: 35px;" id="page"></span>
		<span class="r mr-10"  style="line-height: 40px;" id="dataall"></span>  
	</div>
		
</div>
</div>

<!-- 商品列表模版 -->
<script id="test" type="text/html">
  	<% for (x in list) { %>
	<tr class="text-c va-m sort1">
		<td class="valueid"><input name="" type="checkbox" value="<%=list[x].tic_id%>"></td>
		<td><%=list[x].tic_id%></td>
		<!-- <td class="text-l fun-search" data-name="k" data-value="<%=list[x].goods_name%>"><%=list[x].goods_name%></td> -->


		<!-- <%if(list[x].from_type=='sys'){ %>
		<td class="fun-search" data-name="from" data-show="置换返券" data-value="sys">
			置换返券  ( 申请id：<%=list[x].from_id%> )
		</td>
		<%}else if(list[x].from_type=='give'){ %>
		<td class="fun-search" data-name="from" data-show="会员赠送" data-value="give">
			<span style="color:#c62b26">会员赠送  ( 会员id：<%=list[x].from_id%> )</span>
		</td>
		<%}else if(list[x].from_type=='buy'){ %>
		<td class="fun-search" data-name="from" data-show="现金购买" data-value="buy">
			现金购买
		</td>
		<%}%> -->
		<td>
			<%=list[x].from_type_cn%>  ( 申请id：<%=list[x].from_id%> )
		</td>
		
		<!-- <td class="text-l" style=" cursor: pointer;" onClick="_open('图片预览','images-view.html?id=<%=list[x].tic_id%>','90%','80%',true)" >
			<img class="pic-thumb" src="/Manage/images/blank.gif" data-lazy="<%=list[x].goods_image%>">
			
		</td> -->
		<td class="fun-search" data-name="k" data-value="<%=list[x].user_name%>"><%=list[x].user_name%> (<%=list[x].uid%>)</td>

		<td><%=list[x].tic_initial_num%></td>
		<td><%=list[x].tic_num%></td>

		
		<td><%=list[x].tic_addtime%></td>
		<td><%=list[x].yu_days%></td>
		
		
	</tr>
	<%}%>  
</script> 
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script> 
<script type="text/javascript" src="js/template-native.js"></script> 
<script type="text/javascript" src="js/s.js"></script> 


<script type="text/javascript" src="lib/laypage/laypage.js"></script> 
<script type="text/javascript" src="lib/daterangepicker/moment.min.js"></script> 
<script type="text/javascript" src="lib/daterangepicker/jquery.daterangepicker.js"></script>
<script src="/Manage/js/lazyload.min.js"></script>
<script type="text/javascript">
var API=API_QUAN;
var kk=API;//用于搜索和上下翻页
var orderby='';
var search='';

loaddata(API,1,true);
$('#date-range1').dateRangePicker({
	startOfWeek: 'monday',
	separator : ' 至 ',
	format: 'YYYY-MM-DD HH:mm',
	autoClose: true,
	time: {
		enabled: true
	},
	defaultTime: moment().startOf('day').toDate(),
	defaultEndTime: moment().endOf('day').toDate()
});


$(document).ready(function(){ 


	$("#search").click(function(){
		kk=API+"?";
		var param=[
			'k='+encodeURI(document.querySelector('input[name=k]').value),
			'time='+document.querySelector('input[name=time]').value,
			// 'num='+encodeURI(document.querySelector('input[name=shipping_num]').value),
			'from='+document.querySelector('select[name=from]').value,
		];
		search=param.join('&');
	    kk=kk+search+'&'+orderby;
		loaddata(kk,1);
	})

	$(document).on('click','td.searchstore',function(){
		var storeid=$(this).data("storeid");
		kk=API+"?sid="+storeid;
		loaddata(kk,1,true);	
	})

	// 导出excel
	$(document).on('click','#export',function(){
	    var param=[
	        'k='+encodeURI(document.querySelector('input[name=k]').value),
			'time='+document.querySelector('input[name=time]').value,
			// 'num='+encodeURI(document.querySelector('input[name=shipping_num]').value),
			'from='+document.querySelector('select[name=from]').value,
	    ];
	    param=param.join('&');
	    window.open(API_QUAN_EXPORT+'?'+param+'&'+orderby);
	    console.log(API_QUAN_EXPORT+'?'+param+'&'+orderby)
	})

   
	
    
})





		



</script>
</body>
</html>